#include <iostream>
#include <string>
using namespace std;
int main() {
    int t;
    cin >> t;
    while(t--) {
        string s;
        cin >> s;
        int ans = 0;
        string a = s;
        do{
            ++ans;
            a.push_back(a[0]);
            a.erase(0, 1);
        }while(s.compare(a)!=0 && ans<s.size());
        cout << ans << endl;
        if(t!=0) cout << endl;
    }
    return 0;
}
/*
 3
 abab
 abca
 aaaa

 */